package top.frsf.starter.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.frsf.starter.utils.Result;


/**
 * @author He Kuntao
 * @desc Feign Client
 * @date 2024/3/15 20:39
 */
@FeignClient(name = "demo", url = "http://localhost:10000/cloud/api/iot/device")
public interface IDeviceClient {


    /**
     * 获取用户的设备列表
     *
     * @return Result
     */
    @GetMapping(headers = {"token=${friot.token}"})
    Result listDevice();

    /**
     * 根据条件查询设备日志
     *
     * @param deviceId   设备ID
     * @param identified 设备标识
     * @param num        查询条数
     * @return 设备日志
     */
    @GetMapping(value = "/things", headers = {"token=${friot.token}"})
    Result listThingsByCondition(@RequestParam(value = "deviceId") String deviceId,
                                 @RequestParam(value = "identified") String identified,
                                 @RequestParam(value = "num", defaultValue = "5") Integer num);
}
